<!--
 * @Author: daidai
 * @Date: 2022-01-12 14:23:32
 * @LastEditors: sunliq sunliq@chanjet.com
 * @LastEditTime: 2023-07-07 20:58:20
 * @FilePath: \web-pc\src\pages\big-screen\view\home.vue
-->
<template>
  <ScaleScreen
    :width="1920"
    :height="1080"
    class="scale-wrap"
    :selfAdaption="$store.state.setting.isScale">
    <div class="bg">
      <dv-loading v-if="loading">Loading...</dv-loading>
      <div v-else class="host-body">
        <!-- 头部 s -->
        <div class="d-flex jc-center title_wrap">
          <div class="line"></div>
          <div class="d-flex jc-center">
            <div class="timers">
                {{ dateYear }}&nbsp;&nbsp;{{ dateWeek }}
            </div>
            <div class="title">
              <span class="title-text">某地市水位监测一张图</span>
            </div>
            <div class="youjuxing">
              <img src="../assets/img/yun.svg" alt="" srcset="">
              <span class="text">夜间多云</span>
              <span class="sheshidu">20～28</span>
              <span class="fh">℃</span>
            </div>
            
          </div>
        </div>
        <router-view></router-view>
      </div>
    </div>
  </ScaleScreen>
</template>

<script>
import { formatTime } from "../utils/index.js";
import Setting from "./setting.vue";
import ScaleScreen from "@/components/scale-screen/scale-screen.vue";
export default {
  components: { Setting, ScaleScreen },
  data() {
    return {
      timing: null,
      loading: true,
      dateDay: null,
      dateYear: null,
      dateWeek: null,
      weekday: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
    };
  },

  computed: {},
  created() {},
  mounted() {
    this.timeFn();
    this.cancelLoading();
  },
  beforeDestroy() {
    clearInterval(this.timing);
  },
  methods: {
    showSetting() {
      this.$refs.setting.init();
    },
    timeFn() {
      this.timing = setInterval(() => {
        this.dateDay = formatTime(new Date(), "HH: mm: ss");
        this.dateYear = formatTime(new Date(), "yyyy 年 MM 月 dd 日");
        this.dateWeek = this.weekday[new Date().getDay()];
      }, 1000);
    },
    cancelLoading() {
      let timer = setTimeout(() => {
        this.loading = false;
        clearTimeout(timer);
      }, 500);
    },
  },
};
</script>

<style lang="scss">
@import "./home.scss";
</style>
